#include "heroz.hh"

HeroZ *heroz;

int main(int argc, char **argv) {
  int i;
  unsigned char *pixels;

  heroz = init_engine("data");
  if(heroz) {
    pixels = (unsigned char*)heroz->screen_buffer->pixels;
    init_threads(heroz);
    for(i = 0; i < 40 * 20; ++i) {
      // Works...
      // SDL_LockSurface(heroz->screen_buffer);
      // pixels[i] = i;
      // SDL_UnlockSurface(heroz->screen_buffer);
      heroz->screen->set(i % 40, i / 40, i);
      if(i < 256) heroz->txtscreen->set(i % 40, i / 40, 255 - i);
      SDL_Delay(3);
    }
    heroz->gfx->sprites.at(0).change_anim(2);
    heroz->gfx->sprites.at(1).change_anim(0);
    heroz->gfx->sprites[1].anim()->set_fps(4);
    heroz->gfx->sprites[1].anim()->move_to(10, 410);
    heroz->gfx->sprites[1].anim()->set_xpps(10);
    SDL_Delay(2000);
    heroz->gfx->sprites.at(1).change_anim(-1);
    SDL_Delay(2000);
    heroz->gfx->sprites.at(1).change_anim(0);
    SDL_Delay(3000);
    heroz->input->poll_events();
    clean_up(heroz);
  }
  return 0;
}
